﻿using System;
using System.Collections.Generic;

namespace JBotAPI.Logs {
	public class JbotLogs : List<JbotLog> {
		#region Events
		public delegate void NewLogEvent(object sender, NewLogEventArgs e);
		public event NewLogEvent LogAdded;
		#endregion

		#region Main functions
		public void Add(string text, LogFlags flag, LogType type) {
			this.Insert(0, new JbotLog( ) {
				text = text,
				flag = flag,
				type = type
			});
			if (LogAdded != null) {
				NewLogEventArgs NLEA = new NewLogEventArgs(text, flag, type);
				//LogAdded.Method.Invoke(LogAdded.Target, new object[ ] { this, NLEA });
				//LogAdded.Invoke(this, NLEA);
				LogAdded(this, NLEA);
			}
		}
		#endregion
	}
}